<div class="form">

    <?php
    $form = $this->beginWidget('CActiveForm', array(
                'id' => 'product-form',
                'enableAjaxValidation' => false,
                'htmlOptions' => array('enctype' => 'multipart/form-data'),
            ));
    ?>

    <p class="note"><span class="required">*</span> là bắt buộc.</p>

    <?php echo $form->errorSummary($model); ?>

    <div class="row">
        <?php echo $form->labelEx($model, 'name'); ?>
        <?php echo $form->textField($model, 'name', array('size' => 60, 'maxlength' => 64)); ?>
        <?php echo $form->error($model, 'name'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'price'); ?>
        <?php echo $form->textField($model, 'price', array('size' => 16, 'maxlength' => 16)); ?>
        <?php echo $form->error($model, 'price'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'amount'); ?>
        <?php echo $form->textField($model, 'amount'); ?>
        <?php echo $form->error($model, 'amount'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'description'); ?>
        <?php echo $form->textArea($model, 'description', array('rows' => 6, 'cols' => 50)); ?>
        <?php echo $form->error($model, 'description'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'image'); ?>
        <?php // echo $form->textField($model, 'image'); ?>
        <?php echo CHtml::activeFileField($model, 'image'); ?>
        <?php echo $form->error($model, 'image'); ?>        
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'category_id'); ?>
        <?php
        $this->widget('application.components.Relation',
                array(
                    'model' => 'Product',
                    'relation' => 'category',
                    'fields' => 'name',
                    'style' => 'selectbox')
        );
        ?>
        <?php echo $form->error($model, 'category_id'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'manufacturer_id'); ?>
        <?php
        $this->widget('application.components.Relation',
                array(
                    'model' => 'Product',
                    'relation' => 'manufacturer',
                    'fields' => 'name',
                    'style' => 'selectbox')
        );
        ?>
        <?php echo $form->error($model, 'manufacturer_id'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'warehouse_id'); ?>
        <?php
        $this->widget('application.components.Relation',
                array(
                    'model' => 'Product',
                    'relation' => 'warehouse',
                    'fields' => 'location',
                    'style' => 'selectbox')
        );
        ?>
        <?php echo $form->error($model, 'warehouse_id'); ?>
    </div>

    <div class="row buttons">
        <?php echo CHtml::submitButton($model->isNewRecord ? 'Tạo' : 'Lưu'); ?>
    </div>

    <?php $this->endWidget(); ?>

</div><!-- form -->